#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 1e5 + 10;
const ll p = 1e9 + 7;
ll n, ans;
ll c[N];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	int tmp;
	for (int i = 1; i <= n; i++) {
		cin >> tmp;
		c[tmp]++;
	}
	for (int i = 1; i <= 2500; i++) {
		for (int j = i; j <= 5000 - i; j++) {
			int k3 = c[i + j], k1 = c[i], k2 = c[j];
			if (k3 >= 2) {
				if (i == j && k1 >= 2) {
					tmp = k1 * (k1 - 1) / 2 * k3 * (k3 - 1) / 2 % p;
					ans += tmp;
				}
				if (i != j && k1 >= 1 && k2 >= 1) {
					tmp = k1 * k2 * k3 * (k3 - 1) / 2 % p;
					ans += tmp;
				}
			}
		}
	}
	ans %= p;
	cout << ans << endl;
	return 0;
}